// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

pub mod recaptcha_enterprise_service {
    use crate::Result;

    /// A builder for [RecaptchaEnterpriseService][crate::client::RecaptchaEnterpriseService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_recaptchaenterprise_v1::*;
    /// # use builder::recaptcha_enterprise_service::ClientBuilder;
    /// # use client::RecaptchaEnterpriseService;
    /// let builder : ClientBuilder = RecaptchaEnterpriseService::builder();
    /// let client = builder
    ///     .with_endpoint("https://recaptchaenterprise.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::RecaptchaEnterpriseService;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = RecaptchaEnterpriseService;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::RecaptchaEnterpriseService] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::create_assessment][crate::client::RecaptchaEnterpriseService::create_assessment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::CreateAssessment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateAssessment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateAssessment(RequestBuilder<crate::model::CreateAssessmentRequest>);

    impl CreateAssessment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateAssessmentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Assessment> {
            (*self.0.stub)
                .create_assessment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::CreateAssessmentRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [assessment][crate::model::CreateAssessmentRequest::assessment].
        ///
        /// This is a **required** field for requests.
        pub fn set_assessment<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Assessment>,
        {
            self.0.request.assessment = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [assessment][crate::model::CreateAssessmentRequest::assessment].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_assessment<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Assessment>,
        {
            self.0.request.assessment = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateAssessment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::annotate_assessment][crate::client::RecaptchaEnterpriseService::annotate_assessment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::AnnotateAssessment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> AnnotateAssessment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct AnnotateAssessment(RequestBuilder<crate::model::AnnotateAssessmentRequest>);

    impl AnnotateAssessment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::AnnotateAssessmentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::AnnotateAssessmentResponse> {
            (*self.0.stub)
                .annotate_assessment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::AnnotateAssessmentRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [annotation][crate::model::AnnotateAssessmentRequest::annotation].
        pub fn set_annotation<T: Into<crate::model::annotate_assessment_request::Annotation>>(
            mut self,
            v: T,
        ) -> Self {
            self.0.request.annotation = v.into();
            self
        }

        /// Sets the value of [reasons][crate::model::AnnotateAssessmentRequest::reasons].
        pub fn set_reasons<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::annotate_assessment_request::Reason>,
        {
            use std::iter::Iterator;
            self.0.request.reasons = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [account_id][crate::model::AnnotateAssessmentRequest::account_id].
        pub fn set_account_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.account_id = v.into();
            self
        }

        /// Sets the value of [hashed_account_id][crate::model::AnnotateAssessmentRequest::hashed_account_id].
        pub fn set_hashed_account_id<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
            self.0.request.hashed_account_id = v.into();
            self
        }

        /// Sets the value of [transaction_event][crate::model::AnnotateAssessmentRequest::transaction_event].
        pub fn set_transaction_event<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::TransactionEvent>,
        {
            self.0.request.transaction_event = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [transaction_event][crate::model::AnnotateAssessmentRequest::transaction_event].
        pub fn set_or_clear_transaction_event<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::TransactionEvent>,
        {
            self.0.request.transaction_event = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for AnnotateAssessment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::create_key][crate::client::RecaptchaEnterpriseService::create_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::CreateKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateKey(RequestBuilder<crate::model::CreateKeyRequest>);

    impl CreateKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateKeyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Key> {
            (*self.0.stub)
                .create_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::CreateKeyRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [key][crate::model::CreateKeyRequest::key].
        ///
        /// This is a **required** field for requests.
        pub fn set_key<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Key>,
        {
            self.0.request.key = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [key][crate::model::CreateKeyRequest::key].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Key>,
        {
            self.0.request.key = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::list_keys][crate::client::RecaptchaEnterpriseService::list_keys] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::ListKeys;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListKeys {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListKeys(RequestBuilder<crate::model::ListKeysRequest>);

    impl ListKeys {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListKeysRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListKeysResponse> {
            (*self.0.stub)
                .list_keys(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListKeysResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<crate::model::ListKeysResponse, gax::error::Error>
        {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListKeysRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListKeysRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListKeysRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListKeys {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::retrieve_legacy_secret_key][crate::client::RecaptchaEnterpriseService::retrieve_legacy_secret_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::RetrieveLegacySecretKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> RetrieveLegacySecretKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct RetrieveLegacySecretKey(
        RequestBuilder<crate::model::RetrieveLegacySecretKeyRequest>,
    );

    impl RetrieveLegacySecretKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::RetrieveLegacySecretKeyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::RetrieveLegacySecretKeyResponse> {
            (*self.0.stub)
                .retrieve_legacy_secret_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [key][crate::model::RetrieveLegacySecretKeyRequest::key].
        ///
        /// This is a **required** field for requests.
        pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.key = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for RetrieveLegacySecretKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::get_key][crate::client::RecaptchaEnterpriseService::get_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::GetKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetKey(RequestBuilder<crate::model::GetKeyRequest>);

    impl GetKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetKeyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Key> {
            (*self.0.stub)
                .get_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetKeyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::update_key][crate::client::RecaptchaEnterpriseService::update_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::UpdateKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateKey(RequestBuilder<crate::model::UpdateKeyRequest>);

    impl UpdateKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateKeyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Key> {
            (*self.0.stub)
                .update_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [key][crate::model::UpdateKeyRequest::key].
        ///
        /// This is a **required** field for requests.
        pub fn set_key<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Key>,
        {
            self.0.request.key = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [key][crate::model::UpdateKeyRequest::key].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Key>,
        {
            self.0.request.key = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateKeyRequest::update_mask].
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateKeyRequest::update_mask].
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::delete_key][crate::client::RecaptchaEnterpriseService::delete_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::DeleteKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteKey(RequestBuilder<crate::model::DeleteKeyRequest>);

    impl DeleteKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteKeyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .delete_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::DeleteKeyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::migrate_key][crate::client::RecaptchaEnterpriseService::migrate_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::MigrateKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> MigrateKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct MigrateKey(RequestBuilder<crate::model::MigrateKeyRequest>);

    impl MigrateKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::MigrateKeyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Key> {
            (*self.0.stub)
                .migrate_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::MigrateKeyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [skip_billing_check][crate::model::MigrateKeyRequest::skip_billing_check].
        pub fn set_skip_billing_check<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.skip_billing_check = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for MigrateKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::add_ip_override][crate::client::RecaptchaEnterpriseService::add_ip_override] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::AddIpOverride;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> AddIpOverride {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct AddIpOverride(RequestBuilder<crate::model::AddIpOverrideRequest>);

    impl AddIpOverride {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::AddIpOverrideRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::AddIpOverrideResponse> {
            (*self.0.stub)
                .add_ip_override(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::AddIpOverrideRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [ip_override_data][crate::model::AddIpOverrideRequest::ip_override_data].
        ///
        /// This is a **required** field for requests.
        pub fn set_ip_override_data<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::IpOverrideData>,
        {
            self.0.request.ip_override_data = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [ip_override_data][crate::model::AddIpOverrideRequest::ip_override_data].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_ip_override_data<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::IpOverrideData>,
        {
            self.0.request.ip_override_data = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for AddIpOverride {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::remove_ip_override][crate::client::RecaptchaEnterpriseService::remove_ip_override] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::RemoveIpOverride;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> RemoveIpOverride {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct RemoveIpOverride(RequestBuilder<crate::model::RemoveIpOverrideRequest>);

    impl RemoveIpOverride {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::RemoveIpOverrideRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::RemoveIpOverrideResponse> {
            (*self.0.stub)
                .remove_ip_override(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::RemoveIpOverrideRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [ip_override_data][crate::model::RemoveIpOverrideRequest::ip_override_data].
        ///
        /// This is a **required** field for requests.
        pub fn set_ip_override_data<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::IpOverrideData>,
        {
            self.0.request.ip_override_data = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [ip_override_data][crate::model::RemoveIpOverrideRequest::ip_override_data].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_ip_override_data<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::IpOverrideData>,
        {
            self.0.request.ip_override_data = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for RemoveIpOverride {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::list_ip_overrides][crate::client::RecaptchaEnterpriseService::list_ip_overrides] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::ListIpOverrides;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListIpOverrides {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListIpOverrides(RequestBuilder<crate::model::ListIpOverridesRequest>);

    impl ListIpOverrides {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListIpOverridesRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListIpOverridesResponse> {
            (*self.0.stub)
                .list_ip_overrides(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListIpOverridesResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<crate::model::ListIpOverridesResponse, gax::error::Error>
        {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListIpOverridesRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListIpOverridesRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListIpOverridesRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListIpOverrides {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::get_metrics][crate::client::RecaptchaEnterpriseService::get_metrics] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::GetMetrics;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetMetrics {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetMetrics(RequestBuilder<crate::model::GetMetricsRequest>);

    impl GetMetrics {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetMetricsRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Metrics> {
            (*self.0.stub)
                .get_metrics(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetMetricsRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetMetrics {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::create_firewall_policy][crate::client::RecaptchaEnterpriseService::create_firewall_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::CreateFirewallPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateFirewallPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateFirewallPolicy(RequestBuilder<crate::model::CreateFirewallPolicyRequest>);

    impl CreateFirewallPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateFirewallPolicyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::FirewallPolicy> {
            (*self.0.stub)
                .create_firewall_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::CreateFirewallPolicyRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [firewall_policy][crate::model::CreateFirewallPolicyRequest::firewall_policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_firewall_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::FirewallPolicy>,
        {
            self.0.request.firewall_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [firewall_policy][crate::model::CreateFirewallPolicyRequest::firewall_policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_firewall_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::FirewallPolicy>,
        {
            self.0.request.firewall_policy = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateFirewallPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::list_firewall_policies][crate::client::RecaptchaEnterpriseService::list_firewall_policies] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::ListFirewallPolicies;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListFirewallPolicies {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListFirewallPolicies(RequestBuilder<crate::model::ListFirewallPoliciesRequest>);

    impl ListFirewallPolicies {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListFirewallPoliciesRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListFirewallPoliciesResponse> {
            (*self.0.stub)
                .list_firewall_policies(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListFirewallPoliciesResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListFirewallPoliciesResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListFirewallPoliciesRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListFirewallPoliciesRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListFirewallPoliciesRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListFirewallPolicies {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::get_firewall_policy][crate::client::RecaptchaEnterpriseService::get_firewall_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::GetFirewallPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetFirewallPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetFirewallPolicy(RequestBuilder<crate::model::GetFirewallPolicyRequest>);

    impl GetFirewallPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetFirewallPolicyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::FirewallPolicy> {
            (*self.0.stub)
                .get_firewall_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetFirewallPolicyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetFirewallPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::update_firewall_policy][crate::client::RecaptchaEnterpriseService::update_firewall_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::UpdateFirewallPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateFirewallPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateFirewallPolicy(RequestBuilder<crate::model::UpdateFirewallPolicyRequest>);

    impl UpdateFirewallPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateFirewallPolicyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::FirewallPolicy> {
            (*self.0.stub)
                .update_firewall_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [firewall_policy][crate::model::UpdateFirewallPolicyRequest::firewall_policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_firewall_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::FirewallPolicy>,
        {
            self.0.request.firewall_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [firewall_policy][crate::model::UpdateFirewallPolicyRequest::firewall_policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_firewall_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::FirewallPolicy>,
        {
            self.0.request.firewall_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateFirewallPolicyRequest::update_mask].
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateFirewallPolicyRequest::update_mask].
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateFirewallPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::delete_firewall_policy][crate::client::RecaptchaEnterpriseService::delete_firewall_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::DeleteFirewallPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteFirewallPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteFirewallPolicy(RequestBuilder<crate::model::DeleteFirewallPolicyRequest>);

    impl DeleteFirewallPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteFirewallPolicyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .delete_firewall_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::DeleteFirewallPolicyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteFirewallPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::reorder_firewall_policies][crate::client::RecaptchaEnterpriseService::reorder_firewall_policies] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::ReorderFirewallPolicies;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ReorderFirewallPolicies {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ReorderFirewallPolicies(
        RequestBuilder<crate::model::ReorderFirewallPoliciesRequest>,
    );

    impl ReorderFirewallPolicies {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ReorderFirewallPoliciesRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ReorderFirewallPoliciesResponse> {
            (*self.0.stub)
                .reorder_firewall_policies(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::ReorderFirewallPoliciesRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [names][crate::model::ReorderFirewallPoliciesRequest::names].
        ///
        /// This is a **required** field for requests.
        pub fn set_names<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.0.request.names = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ReorderFirewallPolicies {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::list_related_account_groups][crate::client::RecaptchaEnterpriseService::list_related_account_groups] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::ListRelatedAccountGroups;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListRelatedAccountGroups {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListRelatedAccountGroups(
        RequestBuilder<crate::model::ListRelatedAccountGroupsRequest>,
    );

    impl ListRelatedAccountGroups {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListRelatedAccountGroupsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListRelatedAccountGroupsResponse> {
            (*self.0.stub)
                .list_related_account_groups(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::ListRelatedAccountGroupsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListRelatedAccountGroupsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListRelatedAccountGroupsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListRelatedAccountGroupsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListRelatedAccountGroupsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListRelatedAccountGroups {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::list_related_account_group_memberships][crate::client::RecaptchaEnterpriseService::list_related_account_group_memberships] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::ListRelatedAccountGroupMemberships;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListRelatedAccountGroupMemberships {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListRelatedAccountGroupMemberships(
        RequestBuilder<crate::model::ListRelatedAccountGroupMembershipsRequest>,
    );

    impl ListRelatedAccountGroupMemberships {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListRelatedAccountGroupMembershipsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(
            self,
        ) -> Result<crate::model::ListRelatedAccountGroupMembershipsResponse> {
            (*self.0.stub)
                .list_related_account_group_memberships(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::ListRelatedAccountGroupMembershipsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListRelatedAccountGroupMembershipsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListRelatedAccountGroupMembershipsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListRelatedAccountGroupMembershipsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListRelatedAccountGroupMembershipsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListRelatedAccountGroupMemberships {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [RecaptchaEnterpriseService::search_related_account_group_memberships][crate::client::RecaptchaEnterpriseService::search_related_account_group_memberships] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_recaptchaenterprise_v1::builder;
    /// use builder::recaptcha_enterprise_service::SearchRelatedAccountGroupMemberships;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> SearchRelatedAccountGroupMemberships {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct SearchRelatedAccountGroupMemberships(
        RequestBuilder<crate::model::SearchRelatedAccountGroupMembershipsRequest>,
    );

    impl SearchRelatedAccountGroupMemberships {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecaptchaEnterpriseService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::SearchRelatedAccountGroupMembershipsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(
            self,
        ) -> Result<crate::model::SearchRelatedAccountGroupMembershipsResponse> {
            (*self.0.stub)
                .search_related_account_group_memberships(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::SearchRelatedAccountGroupMembershipsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::SearchRelatedAccountGroupMembershipsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [project][crate::model::SearchRelatedAccountGroupMembershipsRequest::project].
        ///
        /// This is a **required** field for requests.
        pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.project = v.into();
            self
        }

        /// Sets the value of [account_id][crate::model::SearchRelatedAccountGroupMembershipsRequest::account_id].
        pub fn set_account_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.account_id = v.into();
            self
        }

        /// Sets the value of [hashed_account_id][crate::model::SearchRelatedAccountGroupMembershipsRequest::hashed_account_id].
        #[deprecated]
        pub fn set_hashed_account_id<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
            self.0.request.hashed_account_id = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::SearchRelatedAccountGroupMembershipsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::SearchRelatedAccountGroupMembershipsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for SearchRelatedAccountGroupMemberships {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}
